C-Level Extensibility > The C-level extensibility API > JSBool JS_ValueToDouble()

 

JSBool JS_ValueToDouble()

Description

Extracts a function argument from a jsval, converts it to a double (if possible), and passes the converted value back to the caller.

Arguments

JSContext *cx, jsval v, double *dp

cx is the opaque JSContext pointer that was passed to the JavaScript function.
v is the jsval from which the string is to be extracted.
dp is a pointer to an 8-byte double. This function stores the converted value in *dp.

Returns

A Boolean value indicating success (JS_TRUE) or failure (JS_FALSE).